package site.xuqing.nobean;

import java.util.List;

import site.xuqing.nobean.obj.INonObject;
import site.xuqing.nobean.obj.NonObject;

/**
 * @author xuqing
 * @Description 测试
 * @createTime 2022年01月25日 14:16:15
 */
public class Test {
    public static void main(String[] args) {
        String json="{\"test\":\"123\",\"test1\":[{\"test\":\"456\",\"test1\":\"789\"}]}";
        //*****解析Json*****//
        //用法1
        //NonObject object=NoBean.formJson(json);
        //用法二
        NoBean noBean=NoBean.getInstance();
        noBean.setJson(json);
        NonObject object=noBean.getBean();
        System.out.println((String)object.getValue("test"));
        List<INonObject> objects=object.getList("test1");
        for (INonObject object1:objects){
            System.out.println((String)object1.getValue("test"));
            System.out.println((String)object1.getValue("test1"));
        }
        //*****反解析NonObject*****//
        String jsonStr=NoBean.toJson(object);
    }
}
